#include<iostream>
#include<map>
using namespace std;

/*
    map.emplace(key, value)
        创建一个pair对象，并插入到map中
        如果key已经存在，则返回一个pair对象，pair对象中first为等效元素的迭代器，second为是否插入成功
        
*/

int main()
{
    map<string, string> map1;

    map1.insert(pair<string, string>("张三", "2528班级"));
    map1.insert(make_pair("李四", "2530班级"));
    map1.insert(pair<string, string>("王五", "2528班级"));
    auto b = map1.emplace("小王", "2530班级");
    auto a = map1.emplace("小王", "2532班级");
    for(auto it : map1)
    {
        cout << it.first << " " << it.second << endl;
    }
    cout << a.first->first << " " << a.first->second << endl;
    cout << a.second << endl;

    
    
    return 0;
}